<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Report the error message of the latest function call in the module</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.dbx-connect.html">dbx_connect</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.dbx-escape-string.html">dbx_escape_string</a></div>
 <div class="up"><a href="ref.dbx.html">dbx 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.dbx-error" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">dbx_error</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5 &lt;= 5.0.5, PECL dbx &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">dbx_error</span> &mdash; <span class="dc-title">
   Report the error message of the latest function call in the module
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.dbx-error-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>dbx_error</strong></span>
    ( <span class="methodparam"><span class="type">object</span> <code class="parameter">$link_identifier</code></span>
   )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>dbx_error()</strong></span> returns the last error message.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.dbx-error-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">link_identifier</code></em></dt>

     <dd>

      <p class="para">
       The DBX link object returned by <span class="function"><a href="function.dbx-connect.html" class="function">dbx_connect()</a></span>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.dbx-error-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a string containing the error message from the last function call
   of the abstracted module (e.g. mysql module). If there are multiple 
   connections in the same module, just the last error is given. If there are
   connections on different modules, the latest error is returned for the 
   module specified by the <em><code class="parameter">link_identifier</code></em> parameter.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.dbx-error-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-857">
    <p><strong>Example #1 <span class="function"><strong>dbx_error()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$link&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dbx_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">DBX_MYSQL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"db"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"username"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Could&nbsp;not&nbsp;connect"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dbx_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"select&nbsp;id&nbsp;from&nbsp;non_existing_table"</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">dbx_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">dbx_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 notes" id="refsect1-function.dbx-error-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Always refer to the module-specific documentation as well.
   </p>
   <p class="para">
    The error message for <span class="productname">Microsoft SQL Server</span> is actually the result
    of the <span class="function"><a href="function.mssql-get-last-message.html" class="function">mssql_get_last_message()</a></span> function.
   </p>
   <p class="para">
    The error message for Oracle (oci8) is not implemented yet.
   </p>
  </p></blockquote>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.dbx-connect.html">dbx_connect</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.dbx-escape-string.html">dbx_escape_string</a></div>
 <div class="up"><a href="ref.dbx.html">dbx 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
